package com.fbs.controller;

import com.fbs.entity.User;
import com.fbs.service.UserService;
import com.fbs.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("root")
public class UserContrller {
    @Autowired
    private UserService service;

    //登录接口
    @PostMapping("/login")
    public Result login(@RequestBody User user){

        return service.login(user.getUsername(), user.getPassword());

    }
    //获取侧边栏信息
    @PostMapping("getPermission")
    public Result getPermission(){
        return service.getPermission();
    }
    //模块管理
    @PostMapping("modules")
    public Result modules(){
        return service.modules();
    }
    @PostMapping("delmodules")
    public Result delmodules(Integer id){
        return service.delmodules(id);
    }
    @PostMapping("updatemodules/{id}/{status}")
    public Result updatemodules (@PathVariable Integer id,@PathVariable Integer status){
        return service.updatemodules(id, status);
    }
}
